<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">
<style>
    .city-picker-span{height: 28px !important;overflow: hidden;}
    .placeholder{height: 28px !important;overflow: hidden;}
    .layui-table-body td{height: 37px !important;}
</style>
<body class="laytp-container">
<div id="opt_nav"></div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">人员姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="person_name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">性别</label>
                        <div class="layui-input-block">
                            <select name="sex" lay-filter="sex" >
                                <option value="">请选择</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">身份证号</label>
                        <div class="layui-input-block">
                            <input type="text" name="idcard" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">人员性质</label>
                        <div class="layui-input-block">
                            <div id="nature" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">所属单位</label>
                        <div class="layui-input-block">
                            <div id="chanid" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">人员状态</label>
                        <div class="layui-input-block">
                            <select name="state" id="state">
                                <option value="">请选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">社保状态</label>
                        <div class="layui-input-block">
                            <div id="social" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">参保地</label>
                        <div class="layui-input-block">
                            <input type="text" name="socialareas" id="socialareas" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md3  search_hide none">
                        <label class="layui-form-label">聘费合同编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="number" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3  search_hide none">
                        <label class="layui-form-label">聘期开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="start_dt" placeholder="请输入" class="layui-input bdate_sea_range_ymd" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3  search_hide none">
                        <label class="layui-form-label">聘期结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" name="end_dt" placeholder="请输入" class="layui-input bdate_sea_range_ymd" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">聘用资格</label>
                        <div class="layui-input-block">
                            <div id="qualification" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">证件用途</label>
                        <div class="layui-input-block">
                            <div id="purpose" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">是否可驻场</label>
                        <div class="layui-input-block">
                            <select name="iszhu" id="iszhu"></select>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">聘费支付方式</label>
                        <div class="layui-input-block">
                            <select name="pay_type" id="pay_type"></select>
                        </div>
                    </div>

                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">证书名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="cert_name" id="cert_name" placeholder="请输入" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">证书专业</label>
                        <div class="layui-input-block">
                            <input type="text" name="cert_major" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">证书有效期止</label>
                        <div class="layui-input-block">
                            <input type="text" name="expiry_dt" placeholder="请输入" class="layui-input bdate_sea_range_ymd" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">证书状态</label>
                        <div class="layui-input-block">
                            <select name="cert_state" id="cert_state"></select>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>
    var currButAuth, currTabData, queryStatus=0, sea_nature='',sea_social='', sea_chanid='', sea_qualification='', sea_purpose='';
    layui.use(['table','form','soulTable'], function () {
        var table = layui.table, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        setSouTableExport('报表');
        table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_cert_census_list),where: {}, page: true
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter, height: 'full-140'
            ,request: TabInit.request,response: TabInit.response
            ,contextmenu: get_table_contextmenu(soulTable)
            ,text: TabInit.text
            ,parseData: function (res) {
                currButAuth = res.data.butauth;
                tableButShow(currButAuth);

                if(queryStatus === 0){
                    var stateArr = res.data.state;
                    var state_str = '<option value="">请选择</option>';
                    for(var i in stateArr){
                        state_str += '<option value="'+i+'">'+stateArr[i]+'</option>';
                    }
                    $('#state').html(state_str);

                    var iszhuArr = res.data.iszhu;
                    var iszhu_str = '<option value="">请选择</option>';
                    for(var i in iszhuArr){
                        iszhu_str += '<option value="'+i+'">'+iszhuArr[i]+'</option>';
                    }
                    $('#iszhu').html(iszhu_str);

                    var pay_typeArr = res.data.pay_type;
                    var pay_type_str = '<option value="">请选择</option>';
                    for(var i in pay_typeArr){
                        pay_type_str += '<option value="'+i+'">'+pay_typeArr[i]+'</option>';
                    }
                    $('#pay_type').html(pay_type_str);


                    var cert_stateArr = res.data.cert_state;
                    var cert_states_str = '<option value="">请选择</option>';
                    for(var i in cert_stateArr){
                        cert_states_str += '<option value="'+i+'">'+cert_stateArr[i]+'</option>';
                    }
                    $('#cert_state').html(cert_states_str);

                    load_areas('socialareas', res.data.areas_options, 2);
                    queryStatus = 1;
                }

                xmselect_dan('nature', res.data.nature, sea_nature, function (res) {
                    sea_nature = res.arr && res.arr.length > 0 ? res.arr[0].value : '';
                    searchTableFunc(form, table);
                });
                xmselect_dan('social', res.data.social, sea_social, function (res) {
                    sea_social = res.arr && res.arr.length > 0 ? res.arr[0].value : '';
                    searchTableFunc(form, table);
                });
                xmselect_dan('chanid', res.data.chanid, sea_chanid, function (res) {
                    sea_chanid = res.arr && res.arr.length > 0 ? res.arr[0].value : '';
                    searchTableFunc(form, table);
                });
                xmselect_dan('qualification', res.data.qualification, sea_qualification, function (res) {
                    sea_qualification = res.arr && res.arr.length > 0 ? res.arr[0].value : '';
                    searchTableFunc(form, table);
                });
                xmselect_dan('purpose', res.data.purpose, sea_purpose, function (res) {
                    sea_purpose = res.arr && res.arr.length > 0 ? res.arr[0].value : '';
                    searchTableFunc(form, table);
                });

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type:'numbers',title:'序号',fixed:'left'}
                ,{field: 'name', title: '人员姓名',fixed:'left',merge:true,event:'name',templet:function (e) {
                        return '<span class="colorlan">'+e.name+'</span>';
                    }}
                ,{field: 'sex', title: '性别',merge: 'name'}
                ,{field: 'age', title: '年龄',merge: 'name'}
                ,{field: 'idcard', title: '身份证号',merge: 'name'}
                ,{field: 'xueli', title: '学历',merge: 'name'}
                ,{field: 'nature', title: '人员性质',merge: 'name'}
                ,{field: 'chan_name', title: '所属单位',merge: 'name'}
                ,{field: 'person_state', title: '人员状态',merge: 'name'}
                ,{field: 'social', title: '社保状态',merge: 'name'}
                ,{field: 'socialareas', title: '参保地',merge: 'name'}
                ,{field: 'month', title: '参保月份数',merge: 'name'}
                ,{field: 'number', title: '聘费合同编号',merge: 'name',event:'number',templet:function (e) {
                        return '<span class="colorlan">'+e.number+'</span>';
                    }}
                ,{field: 'start_dt', title: '聘期开始时间',merge: 'name'}
                ,{field: 'end_dt', title: '聘期结束时间',merge: 'name'}
                ,{field: 'qualification', title: '聘用资格',merge: 'name'}
                ,{field: 'purpose', title: '用途',merge: 'name'}
                ,{field: 'iszhu', title: '是否可驻场',merge: 'name'}
                ,{field: 'money', title: '年聘费(元)',merge: 'name'}
                ,{field: 'pay_type', title: '聘费支付方式',merge: 'name'}
                ,{field: 'cert_name', title: '证书名称',event:'cert_name',templet:function (e) {
                        return '<span class="colorlan">'+e.cert_name+'</span>';
                    }}
                ,{field: 'cert_major', title: '证书专业'}
                ,{field: 'cert_numbindex.phper', title: '证书编号'}
                ,{field: 'cert_expiry_dt', title: '有效期止'}
                ,{field: 'cert_state', title: '证书状态'}
                ,{field: 'bid_name', title: '投标在用项目'}
                ,{field: 'engin_name', title: '报建在用项目'}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });

        table.on('tool(datalist)', function (obj) {
            var data = obj.data;
            if(obj.event === 'name'){
                openPage('../cert_person/show.php?id='+data.id);
            }
            if(obj.event === 'number'){
                openPage('../cert_employ/show.php?id='+data.employid);
            }
            if(obj.event === 'cert_name'){
                openPage('../cert/show.php?id='+data.certid);
            }
        });

        listTableSearch(form, table);
    });

</script>
</body>
</html>
